im using it with in the gaia framework do you know it? below is my loop and
'navbut.x' is what im trying to find, i need to add all the widths of all
the dynamic textfields sequentially and then space them out evenly
horizontally ,

im just totally stuck!


for each (var section:XML in siteNav.section) {

                                navbut = new navItem();

        
navbut.label.autoSize=TextFieldAutoSize.LEFT;


                                //Insert the menu text (li...@name reads the
link's "name" attribute)
                                navbut.label.text=secti...@name;
                                //Assign an url to a menu item
                                navbut.linkto=secti...@src;
                                navbut.keepopen=secti...@keep;
                                navbut.isclicked=secti...@highlight;

                                //Insert the menu button to stage

                                navbut.y=0;
                                
                                trace(total);
                                
                                navbut.x= ?;
                                
                                nav1.addChild(navbut);


                                //Make the button look like a button (hand
cursor)
                                navbut.buttonMode=true;
                                navbut.mouseChildren=false;
                                navbut.alpha=0;
                                navbut.name=secti...@url;
                                TweenMax.to(navbut, 0.5, {alpha:1});
                                //Add event handlers (used for animating the
buttons)
        
navbut.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
        
navbut.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
                                navbut.addEventListener(MouseEvent.CLICK,
mouseClickHandler);


                                //trace(navbut.x);

                                //Increment the menu button counter, so we
know how many buttons there are
                                i++;
                        }
                }

-----Original Message-----
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Sidney de
Koning - Funky Monkey Studios
Sent: 25 August 2009 15:52
To: Flash Coders List
Subject: RE: [Flashcoders] spacing horizontal dynamic xml menu textfields

No problem :)
This is using AS3. Where do you have problem with?

Sid


> is this using as2 as im trying to do it in as3 so am a bit confused
>
> -----Original Message-----
> From: flashcoders-boun...@chattyfig.figleaf.com
> [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Sidney de
> Koning
> Sent: 25 August 2009 15:22
> To: Flash Coders List
> Subject: Re: [Flashcoders] spacing horizontal dynamic xml menu textfields
>
> Yup that is correct. X and width, Y and height.
>
> Good luck!
>
> Sid
>
> On Aug 25, 2009, at 3:36 PM, thomas horner wrote:
>
>> Hi thanks, so this is for a vertical menu or positioning vertical
>> textFields,
>>
>> i will try and adjust this for horizontal purposes and measure the
>> width as
>> opposed to the height then?
>>
>> -----Original Message-----
>> From: flashcoders-boun...@chattyfig.figleaf.com
>> [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of
>> Sidney de
>> Koning
>> Sent: 25 August 2009 14:22
>> To: Flash Coders List
>> Subject: Re: [Flashcoders] spacing horizontal dynamic xml menu
>> textfields
>>
>> Hi Thomas,
>>
>> Try to do something like this and adjust it to your own needs;
>>
>> // When you are in a for loop, create new items and and try to measure
>> the height of an item.
>> // And position items vertically.You need to remember the previous
>> item, the fastest way to do this is to have a runningY var declared
>> outside the for loop with an initial value of zero.
>> //See comments in code for further explanation.
>>
>> var runningY:Number = 0;
>> var OFFSET_X:Number = 20;
>>
>> for (var index:int = 0; index < 4 ; index++) {
>>
>>      var _textheader:TextField = new TextField( );
>>      _textheader.text = "Text";
>>      _textheader.autoSize = TextFieldAutoSize.LEFT;
>>      _textheader.x = _background.x - _background.width / 2 + OFFSET_X;
>>      // First iteration  runningY = 0;
>>      // Second iteration runningY = 0 + textHeader.height +2;
>> textHeader.height = 20
>>      // Third iteration  runningY = 22 + textHeader.height +2;
>> textHeader.height = 40 -- mutiple lines of text
>>      // Fourth iteration runningY = 64 + textHeader.height +2;
>> textHeader.height = 20
>>      // Fifth iteration  runningY = 86
>>      _textheader.y = runningY;
>>      runningY += _textheader.height + 2; // textheader = 20
>> }
>>
>>
>>
>> On Aug 25, 2009, at 3:06 PM, thomas horner wrote:
>>
>>>
>>>
>>> Hi all am struggling to position, my textFields generated within my
>>> loop
>>> from my external xml,
>>>
>>>
>>>
>>> i want to evenly space them and as they are dynamic they are all of
>>> different sizes.
>>>
>>>
>>>
>>> i have run a trace on the loop as follows;
>>>
>>>
>>>
>>> trace(navbut.label.width);
>>>
>>>
>>>
>>> which gives me the widths of each field how do it add the total of
>>> the
>>> widths from the loop? to then space them.
>>>
>>> _______________________________________________
>>> Flashcoders mailing list
>>> Flashcoders@chattyfig.figleaf.com
>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>> _______________________________________________
>> Flashcoders mailing list
>> Flashcoders@chattyfig.figleaf.com
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>> _______________________________________________
>> Flashcoders mailing list
>> Flashcoders@chattyfig.figleaf.com
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>


--
Hire me to do your website, businesscards, presentations or flyers.
--
Only those who dare to fail greatly can ever achieve greatly. - Robert F.
Kennedy
--
Sidney de Koning | Flash Developer/Creative Soul/Multimedialist
Funky Monkey Studios | Van Ostadestraat 286 HS | 1073 TW | Amsterdam |
e:sid...@funky-monkey.nl | tel: +31(06)24 548336 | fax: +31 (0)84 747 7288



_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to